*Sam Harper Jan 22 2025
*Replication file for "Do Citizens Know About Other States' Policy Choices"
*Input files: 2023-03-hawk-prq.dta, ec1-adoptions.dta, ec1-salience.dta, stateideo-2023.dta, statepop-2022acs.dta
*Output files: ec1-long.dta, ec1-output1.doc, ec1-output1a.doc, ec1-output1b.doc, ec1-output1c.doc, ec1-output2.doc, ec1-output3.doc, ec1-output3a.doc, ec1-output3b.doc, ec1-output3c.doc, ec1-ints.doc
*Packages used: outreg2
clear all
version 17

*To install outreg2, use this line of code:
*ssc install outreg2

*****2023 Hawkeye Poll
use 2023-03-hawk-prq.dta

reshape long polmarij_ polgunban_ polsuicide_ polimmcol_, i(id) j(statemention)

reshape long pol, i(id statemention) j(policy) string

label define pol 0 "No" 1 "Yes"
label val pol pol

drop if statemention == 9

*****State adoptions
merge m:1 statemention using ec1-adoptions
replace marij = 0 if marij == .
replace gunban = 0 if gunban == .
replace immcol = 0 if immcol == .
replace suicide = 0 if suicide == .

*****Neighboring-state variable
*Change variable c to whether state-mention neighbor's respondent's home state
gen neighbor = 0
replace neighbor = 1 if statenam == "Alabama" & mention_abbrev == "MS"
replace neighbor = 1 if statenam == "Alabama" & mention_abbrev == "TN"
replace neighbor = 1 if statenam == "Alabama" & mention_abbrev == "GA"
replace neighbor = 1 if statenam == "Alabama" & mention_abbrev == "FL"
replace neighbor = 1 if statenam == "Arizona" & mention_abbrev == "CA"
replace neighbor = 1 if statenam == "Arizona" & mention_abbrev == "NV"
replace neighbor = 1 if statenam == "Arizona" & mention_abbrev == "UT"
replace neighbor = 1 if statenam == "Arizona" & mention_abbrev == "NM"
replace neighbor = 1 if statenam == "Arkansas" & mention_abbrev == "MO"
replace neighbor = 1 if statenam == "Arkansas" & mention_abbrev == "TN"
replace neighbor = 1 if statenam == "Arkansas" & mention_abbrev == "MS"
replace neighbor = 1 if statenam == "Arkansas" & mention_abbrev == "LA"
replace neighbor = 1 if statenam == "Arkansas" & mention_abbrev == "TX"
replace neighbor = 1 if statenam == "Arkansas" & mention_abbrev == "OK"
replace neighbor = 1 if statenam == "California" & mention_abbrev == "OR"
replace neighbor = 1 if statenam == "California" & mention_abbrev == "NV"
replace neighbor = 1 if statenam == "California" & mention_abbrev == "AZ"
replace neighbor = 1 if statenam == "Colorado" & mention_abbrev == "WY"
replace neighbor = 1 if statenam == "Colorado" & mention_abbrev == "NE"
replace neighbor = 1 if statenam == "Colorado" & mention_abbrev == "KS"
replace neighbor = 1 if statenam == "Colorado" & mention_abbrev == "OK"
replace neighbor = 1 if statenam == "Colorado" & mention_abbrev == "NM"
replace neighbor = 1 if statenam == "Colorado" & mention_abbrev == "UT"
replace neighbor = 1 if statenam == "Connecticut" & mention_abbrev == "NY"
replace neighbor = 1 if statenam == "Connecticut" & mention_abbrev == "MA"
replace neighbor = 1 if statenam == "Connecticut" & mention_abbrev == "RI"
replace neighbor = 1 if statenam == "Delaware" & mention_abbrev == "MD"
replace neighbor = 1 if statenam == "Delaware" & mention_abbrev == "PA"
replace neighbor = 1 if statenam == "Delaware" & mention_abbrev == "NJ"
replace neighbor = 1 if statenam == "Florida" & mention_abbrev == "AL"
replace neighbor = 1 if statenam == "Florida" & mention_abbrev == "GA"
replace neighbor = 1 if statenam == "Georgia" & mention_abbrev == "FL"
replace neighbor = 1 if statenam == "Georgia" & mention_abbrev == "AL"
replace neighbor = 1 if statenam == "Georgia" & mention_abbrev == "TN"
replace neighbor = 1 if statenam == "Georgia" & mention_abbrev == "NC"
replace neighbor = 1 if statenam == "Georgia" & mention_abbrev == "SC"
replace neighbor = 1 if statenam == "Idaho" & mention_abbrev == "MT"
replace neighbor = 1 if statenam == "Idaho" & mention_abbrev == "WY"
replace neighbor = 1 if statenam == "Idaho" & mention_abbrev == "UT"
replace neighbor = 1 if statenam == "Idaho" & mention_abbrev == "NV"
replace neighbor = 1 if statenam == "Idaho" & mention_abbrev == "OR"
replace neighbor = 1 if statenam == "Idaho" & mention_abbrev == "WA"
replace neighbor = 1 if statenam == "Illinois" & mention_abbrev == "IN"
replace neighbor = 1 if statenam == "Illinois" & mention_abbrev == "KY"
replace neighbor = 1 if statenam == "Illinois" & mention_abbrev == "MO"
replace neighbor = 1 if statenam == "Illinois" & mention_abbrev == "IA"
replace neighbor = 1 if statenam == "Illinois" & mention_abbrev == "WI"
replace neighbor = 1 if statenam == "Indiana" & mention_abbrev == "MI"
replace neighbor = 1 if statenam == "Indiana" & mention_abbrev == "OH"
replace neighbor = 1 if statenam == "Indiana" & mention_abbrev == "KY"
replace neighbor = 1 if statenam == "Indiana" & mention_abbrev == "IL"
replace neighbor = 1 if statenam == "Iowa" & mention_abbrev == "MN"
replace neighbor = 1 if statenam == "Iowa" & mention_abbrev == "WI"
replace neighbor = 1 if statenam == "Iowa" & mention_abbrev == "IL"
replace neighbor = 1 if statenam == "Iowa" & mention_abbrev == "MO"
replace neighbor = 1 if statenam == "Iowa" & mention_abbrev == "NE"
replace neighbor = 1 if statenam == "Iowa" & mention_abbrev == "SD"
replace neighbor = 1 if statenam == "Kansas" & mention_abbrev == "NE"
replace neighbor = 1 if statenam == "Kansas" & mention_abbrev == "MO"
replace neighbor = 1 if statenam == "Kansas" & mention_abbrev == "OK"
replace neighbor = 1 if statenam == "Kansas" & mention_abbrev == "CO"
replace neighbor = 1 if statenam == "Kentucky" & mention_abbrev == "IL"
replace neighbor = 1 if statenam == "Kentucky" & mention_abbrev == "IN"
replace neighbor = 1 if statenam == "Kentucky" & mention_abbrev == "OH"
replace neighbor = 1 if statenam == "Kentucky" & mention_abbrev == "WV"
replace neighbor = 1 if statenam == "Kentucky" & mention_abbrev == "VA"
replace neighbor = 1 if statenam == "Kentucky" & mention_abbrev == "TN"
replace neighbor = 1 if statenam == "Kentucky" & mention_abbrev == "MO"
replace neighbor = 1 if statenam == "Louisiana" & mention_abbrev == "TX"
replace neighbor = 1 if statenam == "Louisiana" & mention_abbrev == "AR"
replace neighbor = 1 if statenam == "Louisiana" & mention_abbrev == "MS"
replace neighbor = 1 if statenam == "Maine" & mention_abbrev == "NH"
replace neighbor = 1 if statenam == "Maryland" & mention_abbrev == "VA"
replace neighbor = 1 if statenam == "Maryland" & mention_abbrev == "WV"
replace neighbor = 1 if statenam == "Maryland" & mention_abbrev == "PA"
replace neighbor = 1 if statenam == "Maryland" & mention_abbrev == "DE"
replace neighbor = 1 if statenam == "Massachusetts" & mention_abbrev == "RI"
replace neighbor = 1 if statenam == "Massachusetts" & mention_abbrev == "CT"
replace neighbor = 1 if statenam == "Massachusetts" & mention_abbrev == "NY"
replace neighbor = 1 if statenam == "Massachusetts" & mention_abbrev == "VT"
replace neighbor = 1 if statenam == "Massachusetts" & mention_abbrev == "NH"
replace neighbor = 1 if statenam == "Michigan" & mention_abbrev == "OH"
replace neighbor = 1 if statenam == "Michigan" & mention_abbrev == "IN"
replace neighbor = 1 if statenam == "Michigan" & mention_abbrev == "WI"
replace neighbor = 1 if statenam == "Minnesota" & mention_abbrev == "WI"
replace neighbor = 1 if statenam == "Minnesota" & mention_abbrev == "IA"
replace neighbor = 1 if statenam == "Minnesota" & mention_abbrev == "SD"
replace neighbor = 1 if statenam == "Minnesota" & mention_abbrev == "ND"
replace neighbor = 1 if statenam == "Mississippi" & mention_abbrev == "LA"
replace neighbor = 1 if statenam == "Mississippi" & mention_abbrev == "AR"
replace neighbor = 1 if statenam == "Mississippi" & mention_abbrev == "TN"
replace neighbor = 1 if statenam == "Mississippi" & mention_abbrev == "AL"
replace neighbor = 1 if statenam == "Missouri" & mention_abbrev == "IA"
replace neighbor = 1 if statenam == "Missouri" & mention_abbrev == "IL"
replace neighbor = 1 if statenam == "Missouri" & mention_abbrev == "KY"
replace neighbor = 1 if statenam == "Missouri" & mention_abbrev == "TN"
replace neighbor = 1 if statenam == "Missouri" & mention_abbrev == "AR"
replace neighbor = 1 if statenam == "Missouri" & mention_abbrev == "OK"
replace neighbor = 1 if statenam == "Missouri" & mention_abbrev == "KS"
replace neighbor = 1 if statenam == "Missouri" & mention_abbrev == "NE"
replace neighbor = 1 if statenam == "Montana" & mention_abbrev == "ND"
replace neighbor = 1 if statenam == "Montana" & mention_abbrev == "SD"
replace neighbor = 1 if statenam == "Montana" & mention_abbrev == "WY"
replace neighbor = 1 if statenam == "Montana" & mention_abbrev == "ID"
replace neighbor = 1 if statenam == "Nebraska" & mention_abbrev == "SD"
replace neighbor = 1 if statenam == "Nebraska" & mention_abbrev == "IA"
replace neighbor = 1 if statenam == "Nebraska" & mention_abbrev == "MO"
replace neighbor = 1 if statenam == "Nebraska" & mention_abbrev == "KS"
replace neighbor = 1 if statenam == "Nebraska" & mention_abbrev == "CO"
replace neighbor = 1 if statenam == "Nebraska" & mention_abbrev == "WY"
replace neighbor = 1 if statenam == "Nevada" & mention_abbrev == "OR"
replace neighbor = 1 if statenam == "Nevada" & mention_abbrev == "ID"
replace neighbor = 1 if statenam == "Nevada" & mention_abbrev == "UT"
replace neighbor = 1 if statenam == "Nevada" & mention_abbrev == "AZ"
replace neighbor = 1 if statenam == "Nevada" & mention_abbrev == "CA"
replace neighbor = 1 if statenam == "New Hampshire" & mention_abbrev == "ME"
replace neighbor = 1 if statenam == "New Hampshire" & mention_abbrev == "MA"
replace neighbor = 1 if statenam == "New Hampshire" & mention_abbrev == "VT"
replace neighbor = 1 if statenam == "New Jersey" & mention_abbrev == "DE"
replace neighbor = 1 if statenam == "New Jersey" & mention_abbrev == "PA"
replace neighbor = 1 if statenam == "New Jersey" & mention_abbrev == "NY"
replace neighbor = 1 if statenam == "New Mexico" & mention_abbrev == "AZ"
replace neighbor = 1 if statenam == "New Mexico" & mention_abbrev == "CO"
replace neighbor = 1 if statenam == "New Mexico" & mention_abbrev == "OK"
replace neighbor = 1 if statenam == "New Mexico" & mention_abbrev == "TX"
replace neighbor = 1 if statenam == "New York" & mention_abbrev == "VT"
replace neighbor = 1 if statenam == "New York" & mention_abbrev == "MA"
replace neighbor = 1 if statenam == "New York" & mention_abbrev == "CT"
replace neighbor = 1 if statenam == "New York" & mention_abbrev == "NJ"
replace neighbor = 1 if statenam == "New York" & mention_abbrev == "PA"
replace neighbor = 1 if statenam == "North Carolina" & mention_abbrev == "VA"
replace neighbor = 1 if statenam == "North Carolina" & mention_abbrev == "TN"
replace neighbor = 1 if statenam == "North Carolina" & mention_abbrev == "GA"
replace neighbor = 1 if statenam == "North Carolina" & mention_abbrev == "SC"
replace neighbor = 1 if statenam == "North Dakota" & mention_abbrev == "MN"
replace neighbor = 1 if statenam == "North Dakota" & mention_abbrev == "SD"
replace neighbor = 1 if statenam == "North Dakota" & mention_abbrev == "MT"
replace neighbor = 1 if statenam == "Ohio" & mention_abbrev == "PA"
replace neighbor = 1 if statenam == "Ohio" & mention_abbrev == "WV"
replace neighbor = 1 if statenam == "Ohio" & mention_abbrev == "KY"
replace neighbor = 1 if statenam == "Ohio" & mention_abbrev == "IN"
replace neighbor = 1 if statenam == "Ohio" & mention_abbrev == "MI"
replace neighbor = 1 if statenam == "Oklahoma" & mention_abbrev == "KS"
replace neighbor = 1 if statenam == "Oklahoma" & mention_abbrev == "MO"
replace neighbor = 1 if statenam == "Oklahoma" & mention_abbrev == "AR"
replace neighbor = 1 if statenam == "Oklahoma" & mention_abbrev == "TX"
replace neighbor = 1 if statenam == "Oklahoma" & mention_abbrev == "NM"
replace neighbor = 1 if statenam == "Oklahoma" & mention_abbrev == "CO"
replace neighbor = 1 if statenam == "Oregon" & mention_abbrev == "WA"
replace neighbor = 1 if statenam == "Oregon" & mention_abbrev == "ID"
replace neighbor = 1 if statenam == "Oregon" & mention_abbrev == "NV"
replace neighbor = 1 if statenam == "Oregon" & mention_abbrev == "CA"
replace neighbor = 1 if statenam == "Pennsylvania" & mention_abbrev == "NY"
replace neighbor = 1 if statenam == "Pennsylvania" & mention_abbrev == "NJ"
replace neighbor = 1 if statenam == "Pennsylvania" & mention_abbrev == "DE"
replace neighbor = 1 if statenam == "Pennsylvania" & mention_abbrev == "MD"
replace neighbor = 1 if statenam == "Pennsylvania" & mention_abbrev == "WV"
replace neighbor = 1 if statenam == "Pennsylvania" & mention_abbrev == "OH"
replace neighbor = 1 if statenam == "Rhode Island" & mention_abbrev == "MA"
replace neighbor = 1 if statenam == "Rhode Island" & mention_abbrev == "CT"
replace neighbor = 1 if statenam == "South Carolina" & mention_abbrev == "NC"
replace neighbor = 1 if statenam == "South Carolina" & mention_abbrev == "GA"
replace neighbor = 1 if statenam == "South Dakota" & mention_abbrev == "ND"
replace neighbor = 1 if statenam == "South Dakota" & mention_abbrev == "MN"
replace neighbor = 1 if statenam == "South Dakota" & mention_abbrev == "IA"
replace neighbor = 1 if statenam == "South Dakota" & mention_abbrev == "NE"
replace neighbor = 1 if statenam == "South Dakota" & mention_abbrev == "WY"
replace neighbor = 1 if statenam == "South Dakota" & mention_abbrev == "MT"
replace neighbor = 1 if statenam == "Tennessee" & mention_abbrev == "KY"
replace neighbor = 1 if statenam == "Tennessee" & mention_abbrev == "VA"
replace neighbor = 1 if statenam == "Tennessee" & mention_abbrev == "NC"
replace neighbor = 1 if statenam == "Tennessee" & mention_abbrev == "GA"
replace neighbor = 1 if statenam == "Tennessee" & mention_abbrev == "AL"
replace neighbor = 1 if statenam == "Tennessee" & mention_abbrev == "MS"
replace neighbor = 1 if statenam == "Tennessee" & mention_abbrev == "AR"
replace neighbor = 1 if statenam == "Tennessee" & mention_abbrev == "MO"
replace neighbor = 1 if statenam == "Texas" & mention_abbrev == "NM"
replace neighbor = 1 if statenam == "Texas" & mention_abbrev == "OK"
replace neighbor = 1 if statenam == "Texas" & mention_abbrev == "AR"
replace neighbor = 1 if statenam == "Texas" & mention_abbrev == "LA"
replace neighbor = 1 if statenam == "Utah" & mention_abbrev == "ID"
replace neighbor = 1 if statenam == "Utah" & mention_abbrev == "WY"
replace neighbor = 1 if statenam == "Utah" & mention_abbrev == "CO"
replace neighbor = 1 if statenam == "Utah" & mention_abbrev == "AZ"
replace neighbor = 1 if statenam == "Utah" & mention_abbrev == "NV"
replace neighbor = 1 if statenam == "Vermont" & mention_abbrev == "NH"
replace neighbor = 1 if statenam == "Vermont" & mention_abbrev == "MA"
replace neighbor = 1 if statenam == "Vermont" & mention_abbrev == "NY"
replace neighbor = 1 if statenam == "Virginia" & mention_abbrev == "MD"
replace neighbor = 1 if statenam == "Virginia" & mention_abbrev == "WV"
replace neighbor = 1 if statenam == "Virginia" & mention_abbrev == "KY"
replace neighbor = 1 if statenam == "Virginia" & mention_abbrev == "TN"
replace neighbor = 1 if statenam == "Virginia" & mention_abbrev == "NC"
replace neighbor = 1 if statenam == "Washington" & mention_abbrev == "ID"
replace neighbor = 1 if statenam == "Washington" & mention_abbrev == "OR"
replace neighbor = 1 if statenam == "West Virginia" & mention_abbrev == "PA"
replace neighbor = 1 if statenam == "West Virginia" & mention_abbrev == "MD"
replace neighbor = 1 if statenam == "West Virginia" & mention_abbrev == "VA"
replace neighbor = 1 if statenam == "West Virginia" & mention_abbrev == "KY"
replace neighbor = 1 if statenam == "West Virginia" & mention_abbrev == "OH"
replace neighbor = 1 if statenam == "Wisconsin" & mention_abbrev == "MI"
replace neighbor = 1 if statenam == "Wisconsin" & mention_abbrev == "IN"
replace neighbor = 1 if statenam == "Wisconsin" & mention_abbrev == "IL"
replace neighbor = 1 if statenam == "Wisconsin" & mention_abbrev == "IA"
replace neighbor = 1 if statenam == "Wisconsin" & mention_abbrev == "MN"
replace neighbor = 1 if statenam == "Wyoming" & mention_abbrev == "MT"
replace neighbor = 1 if statenam == "Wyoming" & mention_abbrev == "SD"
replace neighbor = 1 if statenam == "Wyoming" & mention_abbrev == "NE"
replace neighbor = 1 if statenam == "Wyoming" & mention_abbrev == "CO"
replace neighbor = 1 if statenam == "Wyoming" & mention_abbrev == "UT"
replace neighbor = 1 if statenam == "Wyoming" & mention_abbrev == "ID"

*****Neighbor adoptions
gen neighbor_marij = neighbor * marij
gen neighbor_gunban = neighbor * gunban
gen neighbor_suicide = neighbor * suicide
gen neighbor_immcol = neighbor * immcol

egen neighborcount_marij = sum(neighbor_marij), by(id)
egen neighborcount_gunban = sum(neighbor_gunban), by(id)
egen neighborcount_suicide = sum(neighbor_suicide), by(id)
egen neighborcount_immcol = sum(neighbor_immcol), by(id)

replace neighborcount_marij = neighborcount_marij / 4
replace neighborcount_gunban = neighborcount_gunban / 4
replace neighborcount_immcol = neighborcount_immcol / 4
replace neighborcount_suicide = neighborcount_suicide / 4

gen neighborcount = 0
replace neighborcount = neighborcount_marij if policy == "marij_"
replace neighborcount = neighborcount_immcol if policy == "immcol_"
replace neighborcount = neighborcount_suicide if policy == "suicide_"
replace neighborcount = neighborcount_gunban if policy == "gunban_"

*****Descriptive statistics
***Percentage who name a neighbor
gen namedneighbor = 0 if neighbor == 1
replace namedneighbor = 1 if pol == 1 & neighbor == 1
egen namedneighbor_marij = sum(namedneighbor) if policy == "marij_", by(id)
egen namedneighbor_gunban = sum(namedneighbor) if policy == "gunban_", by(id)
egen namedneighbor_suicide = sum(namedneighbor) if policy == "suicide_", by(id)
egen namedneighbor_immcol = sum(namedneighbor) if policy == "immcol_", by(id)

***Number answered, by ID
drop if mention_abbrev == "AK" | mention_abbrev == "HI"
replace mention_abbrev = "DK" if mention_abbrev == ""
gen choice_nodk = pol
replace choice_nodk = 0 if mention_abbrev == "DK"
egen count_marij = sum(choice_nodk) if policy == "marij_", by(id)
egen count_gunban = sum(choice_nodk) if policy == "gunban_", by(id)
egen count_suicide = sum(choice_nodk) if policy == "suicide_", by(id)
egen count_immcol = sum(choice_nodk) if policy == "immcol_", by(id)

gen count = 0
replace count = count_marij if policy == "marij_"
replace count = count_gunban if policy == "gunban_"
replace count = count_suicide if policy == "suicide_"
replace count = count_immcol if policy == "immcol_"
replace pol = 1 if count == 0 & mention_abbrev == "DK"

*****Race/ethnicity
recode race (2=1) (1=0) (3/6=0) (.a=0) (.b=0), gen(black)
recode race (5=1) (1/4=0) (6=0) (.a=0) (.b=0), gen(hispanic)
recode race (3=1) (1/2=0) (4/6=0) (.a=0) (.b=0), gen(asian)
recode race (4=1) (6=1) (.a=1) (.b=1) (1/3=0) (5=0), gen(otherrace)

*****Female
replace female = female - 1
drop if female == 2

*****Education
drop if educ == .a | educ == .b

*****Income
impute income black hispanic asian otherrace female educ, gen(income_imputed)

*****Partisanship/ideology
recode pid7 (1=1) (2/7=0) (.a=0) (.b=0), gen(strongdem)
recode pid7 (2=1) (1=0) (3/7=0) (.a=0) (.b=0), gen(weakdem)
recode pid7 (6=1) (1/5=0) (7=0) (.a=0) (.b=0), gen(weakgop)
recode pid7 (7=1) (1/6=0) (.a=0) (.b=0), gen(stronggop)

recode pid1 (1=1) (2/5=0) (.a=0) (.b=0), gen(democrat)
recode pid1 (2=1) (1=0) (3/5=0) (.a=0) (.b=0), gen(republican)

recode ideol7 (1=1) (2=2) (3=3) (4=4) (5=5) (6=6) (7=7) (.a=4) (.b=4), gen(ideo7)

rename mention_abbrev state_abbrev
drop _merge
merge m:1 state_abbrev using stateideo-2023
drop if _merge == 2
rename state_abbrev mention_abbrev

*****Own state
replace statenam = upper(statenam)
gen ownstate = 0
replace ownstate = 1 if statenam == mention_name

gen ownstate_adopter = ownstate * marij if policy == "marij_"
replace ownstate_adopter = ownstate * gunban if policy == "gunban_"
replace ownstate_adopter = ownstate * immcol if policy == "immcol_"
replace ownstate_adopter = ownstate * suicide if policy == "suicide_"

*****State popoulation
drop _merge
merge m:1 mention_abbrev using statepop-2022acs
drop if _merge == 2

egen popmean_marij = mean(popmil) if marij == 1
egen popmean_gunban = mean(popmil) if gunban == 1
egen popmean_immcol = mean(popmil) if immcol == 1
egen popmean_suicide = mean(popmil) if suicide == 1

gen popmean = popmean_marij if policy == "marij_"
replace popmean = popmean_gunban if policy == "gunban_"
replace popmean = popmean_immcol if policy == "immcol_"
replace popmean = popmean_suicide if policy == "suicide_"

*****Salience
rename statenam state_name
drop _merge
merge m:1 state_name using ec1-salience
gen salience = salience_marij if policy == "marij_"
replace salience = salience_gunban if policy == "gunban_"
replace salience = salience_suicide if policy == "suicide_"
replace salience = salience_tuition if policy == "immcol_"
save ec1-long, replace

*****PART 1*****
encode policy, gen(policy_enc)
drop state_name state_abbrev mention_abbrev mention_name
replace ownstate_adopter = . if ownstate_adopter == 0
collapse (mean) age-policy_enc, by(id policy)
replace ownstate_adopter = 0 if ownstate_adopter == .

recode count (0=1) (1/3=0), gen(dontknow)

*Ideology binaries models
logit dontknow age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighborcount ownstate_adopter salience if policy == "marij_"
outreg2 using ec1-output1.doc, replace

logit dontknow age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighborcount ownstate_adopter salience if policy == "gunban_"
outreg2 using ec1-output1.doc

logit dontknow age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighborcount ownstate_adopter if policy == "suicide_"
outreg2 using ec1-output1.doc

logit dontknow age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighborcount ownstate_adopter salience if policy == "immcol_"
outreg2 using ec1-output1.doc

logit dontknow age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighborcount ownstate_adopter salience b3.policy_enc, vce(cluster id) 
est store part1
outreg2 using ec1-output1.doc

label var age "Age"
label var income_imputed "Income"
label var educ "Education"
label var black "Black"
label var hispanic "Hispanic"
label var asian "Asian"
label var otherrace "Other race"
label var female "Female"
label var democrat "Democrat"
label var republican "Republican"
label define ideo7 1 "Strong liberal" 2 "Liberal" 3 "Weak liberal" 4 "Moderate" 5 "Weak conservative" 6 "Conservative" 7 "Strong conservative"
label val ideo7 ideo7
label var neighborcount "Neighbors with policy"
label var ownstate_adopter "Own state has policy"
label var salience "Policy salience in home state"
label define policy_enc 1 "Gun ban" 2 "Tuition" 3 "Marijuana" 4 "Suicide", replace
label val policy_enc policy_enc

*Strong/weak partisan models
logit dontknow age income_imputed educ black hispanic asian otherrace female strongdem weakdem weakgop stronggop ideo7 neighborcount ownstate_adopter salience if policy == "marij_"
outreg2 using ec1-output1a.doc, replace

logit dontknow age income_imputed educ black hispanic asian otherrace female strongdem weakdem weakgop stronggop ideo7 neighborcount ownstate_adopter salience if policy == "gunban_"
outreg2 using ec1-output1a.doc

logit dontknow age income_imputed educ black hispanic asian otherrace female strongdem weakdem weakgop stronggop ideo7 neighborcount ownstate_adopter if policy == "suicide_"
outreg2 using ec1-output1a.doc

logit dontknow age income_imputed educ black hispanic asian otherrace female strongdem weakdem weakgop stronggop ideo7 neighborcount ownstate_adopter salience if policy == "immcol_"
outreg2 using ec1-output1a.doc

logit dontknow age income_imputed educ black hispanic asian otherrace female strongdem weakdem weakgop stronggop ideo7 neighborcount ownstate_adopter salience b3.policy_enc, vce(cluster id)
outreg2 using ec1-output1a.doc

*Main models, SEs clustered on state
logit dontknow age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighborcount ownstate_adopter salience if policy == "marij_", vce(cluster state)
outreg2 using ec1-output1b.doc, replace

logit dontknow age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighborcount ownstate_adopter salience if policy == "gunban_", vce(cluster state)
outreg2 using ec1-output1b.doc

logit dontknow age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighborcount ownstate_adopter if policy == "suicide_", vce(cluster state)
outreg2 using ec1-output1b.doc

logit dontknow age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighborcount ownstate_adopter salience if policy == "immcol_", vce(cluster state)
outreg2 using ec1-output1b.doc

logit dontknow age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighborcount ownstate_adopter salience b3.policy_enc, vce(cluster state)
outreg2 using ec1-output1b.doc

*Main models, no salience
logit dontknow age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighborcount ownstate_adopter if policy == "marij_"
outreg2 using ec1-output1c.doc, replace

logit dontknow age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighborcount ownstate_adopter if policy == "gunban_"
outreg2 using ec1-output1c.doc

logit dontknow age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighborcount ownstate_adopter if policy == "suicide_"
outreg2 using ec1-output1c.doc

logit dontknow age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighborcount ownstate_adopter if policy == "immcol_"
outreg2 using ec1-output1c.doc

logit dontknow age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighborcount ownstate_adopter b3.policy_enc, vce(cluster id) 
outreg2 using ec1-output1c.doc

*Marginal effects
est restore part1
margins, at(age=(18 30 40 50 60 70 80 90))
marginsplot, name(age1) recastci(rarea) graphregion(fcolor(white)) xtitle("Age") title("")
margins, at(age=(32 66))
margins, at(educ=(1 2 3 4 5 6 7))
marginsplot, name(educ1) recastci(rarea) graphregion(fcolor(white)) xtitle("Education") xlabel(1 "<HS" 3 "HS grad" 5 "Some coll." 7 "Postgrad") title("Educated less likely to answer 'don't know'") ytitle("Predicted probability of answering 'don't know'") note("95% confidence intervals shown")
margins, at(female=(0 1))
marginsplot, name(female1) recast(scatter) graphregion(fcolor(white))
margins, at(democrat=(0 1))
marginsplot, name(democrat1) recast(scatter) graphregion(fcolor(white)) xtitle("Democrat") xlabel(0 "No" 1 "Yes") title("")
margins, at(republican=(0 1))
margins, at(democrat=(0) republican=(0))
margins, at(ideo7=(1 2 3 4 5 6 7))
*Figure 1
marginsplot, title("") recast(scatter) xlabel(1 "Strong L" 2 "Liberal" 3 "Weak L" 4 "Moderate" 5 "Weak C" 6 "Conservative" 7 "Strong C") xtitle("Respondent ideology") ytitle("Predicted probability of answering 'don't know'") note("95% confidence intervals shown") graphregion(fcolor(white))
marginsplot, title("") recast(scatter) xlabel(1 "Strong L" 4 "Moderate" 7 "Strong C") xtitle("Respondent ideology") name(ideo1_1) graphregion(fcolor(white)) title("Strong ideologues slightly less likely to answer 'don't know'") ytitle("Predicted probability of answering 'don't know'") note("95% confidence intervals shown")
margins, at(ownstate=(0 1))
marginsplot, name(ownstate1) recast(scatter) graphregion(fcolor(white)) xtitle("Own state has policy?") xlabel(0 "No" 1 "Yes") title("")
*Figure 2
margins, at(policy_enc=(3 1 4 2))
marginsplot, name(policy1) title ("") recast(scatter) xlabel(3 "Marijuana" 1 "Gun ban" 4 "Suicide" 2 "Tuition") xtitle("Policy") ytitle("Predicted probability of answering 'don't know'") note("95% confidence intervals shown") graphregion(fcolor(white))
marginsplot, name(policy1_1) title ("") recast(scatter) xlabel(3 "Marijuana" 1 "Gun ban" 4 "Suicide" 2 "Tuition") xtitle("Policy") graphregion(fcolor(white)) ytitle("Predicted probability of answering 'don't know'") title("Respondents less likely to answer 'don't know' for marijuana") note("95% confidence intervals shown")

*****PART 2*****
use ec1-long, clear
drop if mention_abbrev == "DK"
sort id policy pol mention_name
by id policy pol: gen selectionno = _n
expand 3
sort id policy mention_name
by id policy mention_name: gen iteration = _n
replace pol = 0 if selectionno != iteration
gen choiceid = iteration * 10000 + id
save ec1-long.dta, replace

***Marijuana
drop if policy != "marij_"
asclogit pol marij neighbor ownstate eliteideo popmil, case(choiceid) alt(mention_abbrev) nocons base("CA") vce(cluster id)
outreg2 using ec1-output2.doc, replace
asclogit pol marij##neighbor marij##c.eliteideo marij##c.popmil ownstate, case(choiceid) alt(mention_abbrev) nocons base("CA") vce(cluster id)
outreg2 using ec1-ints.doc, replace
*Marginal effects
gen yhat_marij0 = invlogit(.996*neighbor + 2.612*ownstate + 0.016*eliteideo + 0.048*popmil)
gen yhat_marij1 = invlogit(1.721 + .996*neighbor + 2.612*ownstate + 0.016*eliteideo + 0.048*popmil)

gen yhat_neighbor0 = invlogit(1.721*marij + 2.612*ownstate + 0.016*eliteideo + 0.048*popmil)
gen yhat_neighbor1 = invlogit(1.721*marij + .996 + 2.612*ownstate + 0.016*eliteideo + 0.048*popmil)

gen yhat_ownstate0 = invlogit(1.721*marij + 0.996*neighbor + 0.016*eliteideo + 0.048*popmil)
gen yhat_ownstate1 = invlogit(1.721*marij + 0.996*neighbor + 2.612 + 0.016*eliteideo + 0.048*popmil)

gen yhat_eliteideo1 = invlogit(1.721*marij + 0.996*neighbor + 2.612*ownstate + 0.016*17.5 + 0.048*popmil)
gen yhat_eliteideo2 = invlogit(1.721*marij + 0.996*neighbor + 2.612*ownstate + 0.016*71.5 + 0.048*popmil)

gen yhat_popmil1 = invlogit(1.721*marij + 0.996*neighbor + 2.612*ownstate + 0.016*eliteideo + 0.048*0.581)
gen yhat_popmil2 = invlogit(1.721*marij + 0.996*neighbor + 2.612*ownstate + 0.016*eliteideo + 0.048*39.029)

***Gun ban
use ec1-long, clear
drop if policy != "gunban_"
asclogit pol gunban neighbor ownstate eliteideo popmil, case(choiceid) alt(mention_abbrev) nocons base("CA") vce(cluster id)
outreg2 using ec1-output2.doc
asclogit pol gunban##neighbor gunban##c.eliteideo gunban##c.popmil ownstate, case(choiceid) alt(mention_abbrev) nocons base("CA") vce(cluster id)
outreg2 using ec1-ints.doc

*Marginal effects
gen yhat_gunban0 = invlogit(neighbor*0.546 + ownstate*2.127 + eliteideo*0.014 + popmil*0.042)
gen yhat_gunban1 = invlogit(1.056 + neighbor*0.546 + ownstate*2.127 + eliteideo*0.014 + popmil*0.042)

gen yhat_neighbor0 = invlogit(1.056*gunban + 2.127*ownstate + 0.014*eliteideo + 0.042*popmil)
gen yhat_neighbor1 = invlogit(1.056*gunban + 0.546 + 2.127*ownstate + 0.014*eliteideo + 0.042*popmil)

gen yhat_ownstate0 = invlogit(1.056*gunban + 0.546*neighbor + 0.014*eliteideo + 0.042*popmil)
gen yhat_ownstate1 = invlogit(1.056*gunban + 0.546*neighbor + 2.127 + 0.014*eliteideo + 0.042*popmil)

gen yhat_eliteideo1 = invlogit(1.056*gunban + 0.546*neighbor + 2.127*ownstate + 0.014*17.5 + 0.042*popmil)
gen yhat_eliteideo2 = invlogit(1.056*gunban + 0.546*neighbor + 2.127*ownstate + 0.014*71.5 + 0.042*popmil)

gen yhat_popmil1 = invlogit(1.056*gunban + 0.546*neighbor + 2.127*ownstate + 0.014*eliteideo + 0.042*0.581)
gen yhat_popmil2 = invlogit(1.056*gunban + 0.546*neighbor + 2.127*ownstate + 0.014*eliteideo + 0.042*39.029)

***Suicide
use ec1-long, clear
drop if policy != "suicide_"
asclogit pol suicide neighbor ownstate eliteideo popmil, case(choiceid) alt(mention_abbrev) nocons base("CA") vce(cluster id)
outreg2 using ec1-output2.doc
asclogit pol suicide##neighbor suicide##c.eliteideo suicide##c.popmil ownstate, case(choiceid) alt(mention_abbrev) nocons base("CA") vce(cluster id)
outreg2 using ec1-ints.doc

*Marginal effects
gen yhat_suicide0 = invlogit(0.595*neighbor + 2.086*ownstate + 0.013*eliteideo + 0.015*popmil)
gen yhat_suicide1 = invlogit(1.279 + 0.595*neighbor + 2.086*ownstate + 0.013*eliteideo + 0.015*popmil)

gen yhat_neighbor0 = invlogit(1.279*suicide + 2.086*ownstate + 0.013*eliteideo + 0.015*popmil)
gen yhat_neighbor1 = invlogit(1.279*suicide + 0.595 + 2.086*ownstate + 0.013*eliteideo + 0.015*popmil)

gen yhat_ownstate0 = invlogit(1.279*suicide + 0.595*neighbor + 0.013*eliteideo + 0.015*popmil)
gen yhat_ownstate1 = invlogit(1.279*suicide + 0.595*neighbor + 2.086 + 0.013*eliteideo + 0.015*popmil)

gen yhat_eliteideo1 = invlogit(1.279*suicide + 0.595*neighbor + 2.086*ownstate + 0.013*17.5 + 0.015*popmil)
gen yhat_eliteideo2 = invlogit(1.279*suicide + 0.595*neighbor + 2.086*ownstate + 0.013*71.5 + 0.015*popmil)

gen yhat_popmil1 = invlogit(1.279*suicide + 0.595*neighbor + 2.086*ownstate + 0.013*eliteideo + 0.015*0.585)
gen yhat_popmil2 = invlogit(1.279*suicide + 0.595*neighbor + 2.086*ownstate + 0.013*eliteideo + 0.015*39.029)

***Tuition
use ec1-long, clear
drop if policy != "immcol_"
asclogit pol immcol neighbor ownstate eliteideo popmil, case(choiceid) alt(mention_abbrev) nocons base("CA") vce(cluster id)
outreg2 using ec1-output2.doc
asclogit pol immcol##neighbor immcol##c.eliteideo immcol##c.popmil ownstate, case(choiceid) alt(mention_abbrev) nocons base("CA") vce(cluster id)
outreg2 using ec1-ints.doc
*Marginal effects
gen yhat_immcol0 = invlogit(0.713*neighbor + 2.013*ownstate + 0.025*eliteideo + 0.057*popmil)
gen yhat_immcol1 = invlogit(0.056 + 0.713*neighbor + 2.013*ownstate + 0.025*eliteideo + 0.057*popmil)

gen yhat_neighbor0 = invlogit(0.056*immcol + 2.013*ownstate + 0.025*eliteideo + 0.057*popmil)
gen yhat_neighbor1 = invlogit(0.056*immcol + 0.713 + 2.013*ownstate + 0.025*eliteideo + 0.057*popmil)

gen yhat_ownstate0 = invlogit(0.056*immcol + 0.713*neighbor + 0.025*eliteideo + 0.057*popmil)
gen yhat_ownstate1 = invlogit(0.056*immcol + 0.713*neighbor + 2.013 + 0.025*eliteideo + 0.057*popmil)

gen yhat_eliteideo1 = invlogit(0.056*immcol + 0.713*neighbor + 2.013*ownstate + 0.025*17.5 + 0.057*popmil)
gen yhat_eliteideo2 = invlogit(0.056*immcol + 0.713*neighbor + 2.013*ownstate + 0.025*71.5 + 0.057*popmil)

gen yhat_popmil1 = invlogit(0.056*immcol + 0.713*neighbor + 2.013*ownstate + 0.025*popmil + 0.057*0.585)
gen yhat_popmil2 = invlogit(0.056*immcol + 0.713*neighbor + 2.013*ownstate + 0.025*popmil + 0.057*39.029)

*****PART 3****
use ec1-long, clear
drop if pol != 1

gen correct = 0
replace correct = 1 if marij == 1 & policy == "marij_"
replace correct = 1 if gunban == 1 & policy == "gunban_"
replace correct = 1 if suicide == 1 & policy == "suicide_"
replace correct = 1 if immcol == 1 & policy == "immcol_"

encode policy, gen(policy_enc)

*Ideology binaries tests
logit correct age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighbor ownstate eliteideo popmil count salience if policy == "marij_", vce(cluster id)
outreg2 using ec1-output3.doc, replace

logit correct age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighbor ownstate eliteideo popmil count salience if policy == "gunban_", vce(cluster id)
outreg2 using ec1-output3.doc

logit correct age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighbor ownstate eliteideo popmil count if policy == "suicide_", vce(cluster id)
outreg2 using ec1-output3.doc

logit correct age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighbor ownstate eliteideo popmil count salience if policy == "immcol_", vce(cluster id)
outreg2 using ec1-output3.doc

logit correct age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighbor ownstate eliteideo popmil count salience b3.policy_enc, vce(cluster id)
outreg2 using ec1-output3.doc
est store part3

label var age "Age"
label var income_imputed "Income"
label var educ "Education"
label var black "Black"
label var hispanic "Hispanic"
label var asian "Asian"
label var otherrace "Other race"
label var female "Female"
label var democrat "Democrat"
label var republican "Republican"
label define ideo7 1 "Strong liberal" 2 "Liberal" 3 "Weak liberal" 4 "Moderate" 5 "Weak conservative" 6 "Conservative" 7 "Strong conservative"
label val ideo7 ideo7
label var neighbor "Neighboring state"
label var ownstate "Own state"
label var eliteideo "State elite ideology"
label var popmil "State pop. in millions"
label var count "# of answers R. gave"
label var salience "Policy salience in home state"
label define policy_enc 1 "Gun ban" 2 "Tuition" 3 "Marijuana" 4 "Suicide", replace
label val policy_enc policy_enc

*VIF tests
regress correct age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighbor ownstate eliteideo popmil count salience if policy == "marij_", vce(cluster id)
vif

regress correct age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighbor ownstate eliteideo popmil count salience if policy == "gunban_", vce(cluster id)
vif

regress correct age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighbor ownstate eliteideo popmil count if policy == "suicide_", vce(cluster id)
vif

regress correct age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighbor ownstate eliteideo popmil count salience if policy == "immcol_", vce(cluster id)
vif

regress correct age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighbor ownstate eliteideo popmil count salience b3.policy_enc, vce(cluster id)
vif

*Strong partisan analyses
logit correct age income_imputed educ black hispanic asian otherrace female strongdem weakdem weakgop stronggop ideo7 neighbor ownstate eliteideo popmil count salience if policy == "marij_", vce(cluster id)
outreg2 using ec1-output3a.doc, replace

logit correct age income_imputed educ black hispanic asian otherrace female strongdem weakdem weakgop stronggop ideo7 neighbor ownstate eliteideo popmil count salience if policy == "gunban_", vce(cluster id)
outreg2 using ec1-output3a.doc

logit correct age income_imputed educ black hispanic asian otherrace female strongdem weakdem weakgop stronggop ideo7 neighbor ownstate eliteideo popmil count if policy == "suicide_", vce(cluster id)
outreg2 using ec1-output3a.doc

logit correct age income_imputed educ black hispanic asian otherrace female strongdem weakdem weakgop stronggop ideo7 neighbor ownstate eliteideo popmil count salience if policy == "immcol_", vce(cluster id)
outreg2 using ec1-output3a.doc

logit correct age income_imputed educ black hispanic asian otherrace female strongdem weakdem weakgop stronggop ideo7 neighbor ownstate eliteideo popmil count salience b3.policy_enc, vce(cluster id)
outreg2 using ec1-output3a.doc

*Standard errors clustered on state
logit correct age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighbor ownstate eliteideo popmil count salience if policy == "marij_", vce(cluster state)
outreg2 using ec1-output3b.doc, replace

logit correct age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighbor ownstate eliteideo popmil count salience if policy == "gunban_", vce(cluster state)
outreg2 using ec1-output3b.doc

logit correct age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighbor ownstate eliteideo popmil count if policy == "suicide_", vce(cluster state)
outreg2 using ec1-output3b.doc

logit correct age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighbor ownstate eliteideo popmil count salience if policy == "immcol_", vce(cluster state)
outreg2 using ec1-output3b.doc

logit correct age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighbor ownstate eliteideo popmil count salience b3.policy_enc, vce(cluster state)
outreg2 using ec1-output3b.doc

*Main models without salience
logit correct age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighbor ownstate eliteideo popmil count if policy == "marij_", vce(cluster id)
outreg2 using ec1-output3c.doc, replace

logit correct age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighbor ownstate eliteideo popmil count if policy == "gunban_", vce(cluster id)
outreg2 using ec1-output3c.doc

logit correct age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighbor ownstate eliteideo popmil count if policy == "suicide_", vce(cluster id)
outreg2 using ec1-output3c.doc

logit correct age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighbor ownstate eliteideo popmil count if policy == "immcol_", vce(cluster id)
outreg2 using ec1-output3c.doc

logit correct age income_imputed educ black hispanic asian otherrace female democrat republican b4.ideo7 neighbor ownstate eliteideo popmil count b3.policy_enc, vce(cluster id)
outreg2 using ec1-output3c.doc

*Marginal effects
est restore part3
margins, at(age=(18 30 40 50 60 70 80 90))
marginsplot, name(age2) recastci(rarea) graphregion(fcolor(white)) title("") xtitle("Age")
margins, at(age=(32 66))
margins, at(educ=(1 2 3 4 5 6 7))
marginsplot, name(educ2) recastci(rarea) graphregion(fcolor(white)) xtitle("Education") xlabel(1 "<HS" 3 "HS grad" 5 "Some coll." 7 "Postgrad") title("")
margins, at(asian=(0 1))
margins, at(ideo7=(1 2 3 4 5 6 7))
margins, at(ownstate=(0 1))
marginsplot, name(ownstate2) recast(scatter) graphregion(fcolor(white)) title("")
margins, at(eliteideo=(17.5 30 40 50 60 71.5))
marginsplot, name(eliteideo) recastci(rarea) graphregion(fcolor(white)) title("") xtitle("State elite liberalism") ytitle("Predicted probability of answer being correct") note("95% confidence intervals shown") title("Respondents know more about more liberal states' policies")
margins, at(eliteideo=(41.59 75.23))
margins, at(popmil=(.581 5 10 15 20 25 30 39.029))
marginsplot, name(popmil) recastci(rarea) graphregion(fcolor(white)) title("") xtitle("State population in millions") ytitle("Predicted probability of answer being correct") note("95% confidence intervals shown") title("Respondents know more about more populous states' policies")
margins, at(popmil=(1.15 28.67))
graph combine age2 ownstate2 eliteideo popmil
*Gun ban
margins, at(policy_enc=(1 3))
*Suicide
margins, at(policy_enc=(3 4))
*Tuition
margins, at(policy_enc=(2 3))
*Figure 2
margins, at(policy_enc=(3 1 4 2))
marginsplot, name(policy2) title ("") recast(scatter) xlabel(3 "Marijuana" 1 "Gun ban" 4 "Suicide" 2 "Tuition") xtitle("Policy") ytitle("Predicted probability of answer being correct") note("95% confidence intervals shown") graphregion(fcolor(white))
marginsplot, name(policy2_1) title ("") recast(scatter) xlabel(3 "Marijuana" 1 "Gun ban" 4 "Suicide" 2 "Tuition") xtitle("Policy") graphregion(fcolor(white)) ytitle("Predicted probability of answer being correct") note("95% confidence intervals shown") title("Respondents more likely to be correct about states with marijuana")